3.1.42 \(\int \frac {A+B \cos (c+d x)}{a+a \cos (c+d x)} \, dx\) [42]

Optimal. Leaf size=34 \[ \frac {B x}{a}+\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))} \]

[Out]

B*x/a+(A-B)*sin(d*x+c)/d/(a+a*cos(d*x+c))

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 34, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {2814, 2727} \begin {gather*} \frac {(A-B) \sin (c+d x)}{d (a \cos (c+d x)+a)}+\frac {B x}{a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(A + B*Cos[c + d*x])/(a + a*Cos[c + d*x]),x]

[Out]

(B*x)/a + ((A - B)*Sin[c + d*x])/(d*(a + a*Cos[c + d*x]))

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rubi steps

\begin {align*} \int \frac {A+B \cos (c+d x)}{a+a \cos (c+d x)} \, dx &=\frac {B x}{a}-(-A+B) \int \frac {1}{a+a \cos (c+d x)} \, dx\\ &=\frac {B x}{a}+\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(72\) vs. \(2(34)=68\).
time = 0.14, size = 72, normalized size = 2.12 \begin {gather*} \frac {\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \left (B d x \cos \left (\frac {d x}{2}\right )+B d x \cos \left (c+\frac {d x}{2}\right )+2 (A-B) \sin \left (\frac {d x}{2}\right )\right )}{a d (1+\cos (c+d x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Cos[c + d*x])/(a + a*Cos[c + d*x]),x]

[Out]

(Cos[(c + d*x)/2]*Sec[c/2]*(B*d*x*Cos[(d*x)/2] + B*d*x*Cos[c + (d*x)/2] + 2*(A - B)*Sin[(d*x)/2]))/(a*d*(1 + C
os[c + d*x]))

________________________________________________________________________________________

Maple [A]
time = 0.09, size = 45, normalized size = 1.32

method result size
derivativedivides \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) \(45\)
default \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) \(45\)
risch \(\frac {B x}{a}+\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}\) \(54\)
norman \(\frac {\frac {B x}{a}+\frac {B x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {\left (A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a}+\frac {\left (A -B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\) \(85\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*cos(d*x+c))/(a+a*cos(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d/a*(A*tan(1/2*d*x+1/2*c)-B*tan(1/2*d*x+1/2*c)+2*B*arctan(tan(1/2*d*x+1/2*c)))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 73 vs. \(2 (34) = 68\).
time = 0.49, size = 73, normalized size = 2.15 \begin {gather*} \frac {B {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + \frac {A \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+a*cos(d*x+c)),x, algorithm="maxima")

[Out]

(B*(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - sin(d*x + c)/(a*(cos(d*x + c) + 1))) + A*sin(d*x + c)/(a*(co
s(d*x + c) + 1)))/d

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 43, normalized size = 1.26 \begin {gather*} \frac {B d x \cos \left (d x + c\right ) + B d x + {\left (A - B\right )} \sin \left (d x + c\right )}{a d \cos \left (d x + c\right ) + a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+a*cos(d*x+c)),x, algorithm="fricas")

[Out]

(B*d*x*cos(d*x + c) + B*d*x + (A - B)*sin(d*x + c))/(a*d*cos(d*x + c) + a*d)

________________________________________________________________________________________

Sympy [A]
time = 0.38, size = 49, normalized size = 1.44 \begin {gather*} \begin {cases} \frac {A \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d} + \frac {B x}{a} - \frac {B \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d} & \text {for}\: d \neq 0 \\\frac {x \left (A + B \cos {\left (c \right )}\right )}{a \cos {\left (c \right )} + a} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+a*cos(d*x+c)),x)

[Out]

Piecewise((A*tan(c/2 + d*x/2)/(a*d) + B*x/a - B*tan(c/2 + d*x/2)/(a*d), Ne(d, 0)), (x*(A + B*cos(c))/(a*cos(c)
 + a), True))

________________________________________________________________________________________

Giac [A]
time = 0.43, size = 43, normalized size = 1.26 \begin {gather*} \frac {\frac {{\left (d x + c\right )} B}{a} + \frac {A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+a*cos(d*x+c)),x, algorithm="giac")

[Out]

((d*x + c)*B/a + (A*tan(1/2*d*x + 1/2*c) - B*tan(1/2*d*x + 1/2*c))/a)/d

________________________________________________________________________________________

Mupad [B]
time = 0.20, size = 30, normalized size = 0.88 \begin {gather*} \frac {\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B\right )}{a}+\frac {B\,d\,x}{a}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*cos(c + d*x))/(a + a*cos(c + d*x)),x)

[Out]

((tan(c/2 + (d*x)/2)*(A - B))/a + (B*d*x)/a)/d

________________________________________________________________________________________